<!-- Wiki of Database Models

Generated by coz on 2/16/2016,
from a template provided by apeman-bud-wiki.

-->


## Database models

+ [Session](#session-model)
+ [User](#user-model)
+ [UserOAuth](#user-o-auth-model)
+ [UserProfile](#user-profile-model)
+ [UserRealm](#user-realm-model)
+ [UserRecover](#user-recover-model)
+ [UserSign](#user-sign-model)
+ [UserVerify](#user-verify-model)

<a id="session-model"></a>
### Session

| Name | Description | Type | Required | unique | Ref |
| ---- | ----------- | ---- | -------- | ------ | --- |
| id |  | integer | Y | N |  |
| expire_at | Date to expire session. | date | Y | N |  |
| session_data | Data of session. | text | Y | N |  |
| session_id | Id of the session. | string | Y | Y |  |
| created_at |  | date | Y | N |  |
| updated_at |  | date | Y | N |  |

<a id="user-model"></a>
### User

| Name | Description | Type | Required | unique | Ref |
| ---- | ----------- | ---- | -------- | ------ | --- |
| id |  | integer | Y | N |  |
| email | Mail address for user. | string | Y | N |  |
| username | Name for identify user. | string | Y | Y |  |
| created_at |  | date | Y | N |  |
| updated_at |  | date | Y | N |  |

<a id="user-o-auth-model"></a>
### UserOAuth

| Name | Description | Type | Required | unique | Ref |
| ---- | ----------- | ---- | -------- | ------ | --- |
| id |  | integer | Y | N |  |
| additional_info | Additional information | text | Y | N |  |
| provided_id | Use identifier in the the provider | string | Y | N |  |
| provided_profile | Use profile in the the provider | text | Y | N |  |
| provider_name | Name of o auth provider | string | Y | N |  |
| user_id | Id of the user. | integer | N | Y | user.id |
| created_at |  | date | Y | N |  |
| updated_at |  | date | Y | N |  |

<a id="user-profile-model"></a>
### UserProfile

| Name | Description | Type | Required | unique | Ref |
| ---- | ----------- | ---- | -------- | ------ | --- |
| id |  | integer | Y | N |  |
| profile_image | Image of the user. | string | Y | N |  |
| profile_name | Name to display | string | Y | N |  |
| user_id | Id of the user. | integer | N | Y | user.id |
| created_at |  | date | Y | N |  |
| updated_at |  | date | Y | N |  |

<a id="user-realm-model"></a>
### UserRealm

| Name | Description | Type | Required | unique | Ref |
| ---- | ----------- | ---- | -------- | ------ | --- |
| id |  | integer | Y | N |  |
| host | Site domain | string | Y | N |  |
| lang | Language to use | string | Y | N |  |
| user_id | Id of the user. | integer | N | Y | user.id |
| created_at |  | date | Y | N |  |
| updated_at |  | date | Y | N |  |

<a id="user-recover-model"></a>
### UserRecover

| Name | Description | Type | Required | unique | Ref |
| ---- | ----------- | ---- | -------- | ------ | --- |
| id |  | integer | Y | N |  |
| expire_at | Date to expire verification | date | Y | N |  |
| recover_token | Token to identify the recover | string | Y | Y |  |
| recovered | Recovered or not | boolean | Y | N |  |
| recovered_at | Date of recovered | date | Y | N |  |
| user_id | Id of the user | integer | N | Y | user.id |
| created_at |  | date | Y | N |  |
| updated_at |  | date | Y | N |  |

<a id="user-sign-model"></a>
### UserSign

| Name | Description | Type | Required | unique | Ref |
| ---- | ----------- | ---- | -------- | ------ | --- |
| id |  | integer | Y | N |  |
| password_hash | Password digest hash. | string | Y | N |  |
| password_salt | Password salt | string | Y | N |  |
| sign_key | Key to identify sign. | string | Y | Y |  |
| sign_key_kind | Kind of key (like &#x27;email&#x27; or &#x27;username&#x27;). | string | Y | N |  |
| signin_at | Date of last time signin. | date | Y | N |  |
| signmod_at | Date of last time signmod. | date | Y | N |  |
| signout_at | Date of last time signout. | date | Y | N |  |
| signup_at | Date of signup. | date | Y | N |  |
| user_id | Id of the user. | integer | N | N | User.id |
| created_at |  | date | Y | N |  |
| updated_at |  | date | Y | N |  |

<a id="user-verify-model"></a>
### UserVerify

| Name | Description | Type | Required | unique | Ref |
| ---- | ----------- | ---- | -------- | ------ | --- |
| id |  | integer | Y | N |  |
| expire_at | Date to expire verification | date | Y | N |  |
| user_id | Id of the user | integer | N | Y | user.id |
| verified | Verified or not | boolean | Y | N |  |
| verified_at | Date of verified | date | Y | N |  |
| verify_target | Target value to verify | string | Y | Y |  |
| verify_target_kind | Kind of target (like &#x27;email&#x27; or &#x27;phone_number&#x27;) | string | Y | N |  |
| verify_token | Token to identify the verify | string | Y | Y |  |
| created_at |  | date | Y | N |  |
| updated_at |  | date | Y | N |  |

